package com.ying.dogying.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ying.dogying.entity.ImUserCollection;
import com.ying.dogying.dao.ImUserCollectionDao;
import com.ying.dogying.service.ImUserCollectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 李华明
 * @since 2020-06-09
 */
@Service
public class ImUserCollectionServiceImpl extends ServiceImpl<ImUserCollectionDao, ImUserCollection> implements ImUserCollectionService {

    @Autowired
    private ImUserCollectionDao imUserCollectionDao;

    @Override
    public IPage<ImUserCollection> selectByUserId(Page page, Long profileId) {
        IPage myCollectionPost = imUserCollectionDao.selectByUserId(page, new QueryWrapper<ImUserCollection>()
                .eq("uc.user_id", profileId)
                .orderByDesc("uc.create_time"));
        return myCollectionPost;
    }
}
